<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        \App\Console\Commands\StatisticsOrder::class,
        \App\Console\Commands\MarketSocket::class,
        \App\Console\Commands\IndexSocket::class,
        \App\Console\Commands\OrdersSocket::class,
        \App\Console\Commands\RechargeExec::class,
        \App\Console\Commands\WalletBalance::class,
        \App\Console\Commands\CreateObaWallet::class,
        \App\Console\Commands\CreateBtcWallet::class,
        \App\Console\Commands\SupplyProperty::class,
        \App\Console\Commands\HandleTurnOut::class,
        \App\Console\Commands\CancelOrder::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('statistics:order')->everyMinute();

        $schedule->command('socket:market')->everyMinute();
        $schedule->command('socket:index')->everyMinute();
        $schedule->command('socket:orders')->everyMinute();

        //自动创建系统钱包
        $schedule->command('system:create_oba_wallet')->everyFiveMinutes();
        $schedule->command('system:create_btc_wallet')->everyFiveMinutes();
        //自动补全用户资产
        //$schedule->command('supply:property')->everyFiveMinutes();
        //自动判断充值
        $schedule->command('recharge:exec')->everyMinute();
        //自动取消订单
        $schedule->command('cancel:order')->everyMinute();

        //自动更新系统钱包余额
        $schedule->command('wallet:balance')->everyFiveMinutes();
        //执行转出操作
        $schedule->command('handle:turn_out')->everyFiveMinutes();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}
